package fr.cie.blog.controller;

import java.util.Map;

import org.apache.struts2.interceptor.SessionAware;

import com.opensymphony.xwork2.ActionSupport;
import com.opensymphony.xwork2.Preparable;
import com.opensymphony.xwork2.util.profiling.UtilTimerStack;

import fr.cie.blog.beans.Config;

/**
 * @author AetM
 * 
 */
public class GenericAction extends ActionSupport implements Preparable,
		SessionAware {
	// serialization properties

	/**
	 * serialVersionUID.
	 */
	private static final long serialVersionUID = 4001274599362401292L;

	// spring properties ..

	// implicit web properties

	/**
	 * configuration.
	 */
	private Config config;

	// g&s

	// spring properties ..

	/**
	 * session.
	 */
	private Map<String, Object> session;

	/**
	 * @return the serial version uid
	 */
	public static final long getSerialversionuid() {
		return serialVersionUID;
	}

	/**
	 * @return the session
	 */
	public final Map<String, Object> getSession() {
		//session = ActionContext.getContext().getSession();
		return session;
	}

	/**
	 * @return the config
	 */
	public final Config getConfig() {
		return config;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see com.opensymphony.xwork2.Preparable#prepare()
	 */
	@Override
	public final void prepare() {
		//UtilTimerStack.setActive(true);
	}

	/**
	 * @param pConfig
	 *            the config to set
	 */
	public final void setConfig(final Config pConfig) {
		this.config = pConfig;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see
	 * org.apache.struts2.interceptor.SessionAware#setSession(java.util.Map)
	 */
	@Override
	public final void setSession(final Map<String, Object> pSession) {
		this.session = pSession;
	}

}